package com.jy.service.impl;

import com.jy.dao.ProductInvestmentDao;
import com.jy.dao.Product_releaseDao;
import com.jy.model.Account;
import com.jy.model.Product_release;
import com.jy.model.WithdrawalRecord;
import com.jy.service.ProductInvestmentService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017/7/25 0025.
 */
@Component
public class ProductInvestmentServiceImpl implements ProductInvestmentService{
        @Resource
    private ProductInvestmentDao productInvestmentDao;
    //产品投资查询
   public List<Product_release> getproduct(Integer rows, Integer page){
       return productInvestmentDao.getproduct(rows,page);
   }
    /*
      * 查询投资id
      */
    public  Product_release tzInfo(String id){
        Product_release pre=productInvestmentDao.tzInfo(id);
        pre.setKymoney(pre.getMoney()-pre.getProduct_investment_amount());
        return pre;
    }
    /*
	 * 产品投资确认投资
	 */
    public int investment(String product_investment_amount,String id){
        return productInvestmentDao.investment( product_investment_amount, id);
    }
    //投资确认
    public List<Account> getcostInfo(Integer page, Integer rows,  String userid){
        return productInvestmentDao.getcostInfo(page,rows,userid);
    }


    public Account getSinglecostInfo(String id){
        return productInvestmentDao.getSinglecostInfo(id);
    }
    public void updateSYL(String id, double investment_profit){
         productInvestmentDao.updateSYL(id,investment_profit);
    }
    /*
	 * 确认
	 */
    public int confirm(Account account){
        return productInvestmentDao.confirm(account);
    }
    /*
	 * 提现确认
	 */
    public int cashfirm(Account account){
        return productInvestmentDao.cashfirm(account);
    }
    //保存提现记录
    public int saveWithdraw(WithdrawalRecord wr){
        return productInvestmentDao.saveWithdraw(wr);
    }

    /*
    * 查询月份
    */
    public List<Account> getaccrued(Integer page, Integer rows,String id){
        return productInvestmentDao.getaccrued(page,rows,id);
    }
}
